package com.fms.constant;

import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import lombok.RequiredArgsConstructor;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

//待完善的权限参考
@RequiredArgsConstructor
public class Reference {
    //角色信息
    public static final BiMap<String, Role> ROLE_MAP = HashBiMap.create(getRoleMap());

    //放行路径
    public static final List<AntPathRequestMatcher> PERMIT_ALL_MATCHER = List.of(
            new AntPathRequestMatcher("/user/login"),
            new AntPathRequestMatcher("/version/list"),
            new AntPathRequestMatcher("/version/download/**")
    );

    private static Map<String,Role> getRoleMap(){
        Map<String,Role> map=new HashMap<>();
        map.put("管理员", Role.ADMIN);
        map.put("经理", Role.MANAGER);
        map.put("开料师", Role.KAILIAO);
        map.put("安装师", Role.INSTALLER);
        map.put("下料师", Role.XIALIAO);
        map.put("设计师", Role.DESIGNER);
        map.put("拆单师", Role.CHAIDAN);
        map.put("总经理", Role.GENERAL_MANAGER);
        map.put("机械师", Role.MACHINIST);
        map.put("文员", Role.CLERK);
        map.put("采购员", Role.PURCHASE);
        map.put("财务员", Role.FINANCE);
        return map;
    }
}